﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看订单详情 - {config.webname}</title>
<meta content="{config.webkeyword}" name="keywords" />
<meta content="{config.webdescription}" name="description" />

<link rel="stylesheet" href="{config.webpath}css/pagination.css" />
<link media="screen" type="text/css" href="<%templateskin%>/css/user.css" rel="stylesheet" />
  <!--css-->
<%template src="cssjs.html"%>
<!--/css-->
<style>
.boxwrap{ margin:0 auto; height:auto; width:400px;text-align:left; }
	.boxwrap:after{clear:both;content:".";display:block;height:0;visibility:hidden;}
</style>
<script type="text/javascript" src="{config.webpath}scripts/lhgdialog/lhgdialog.js?skin=idialog_1"></script>
<script type="text/javascript" src="<%templateskin%>/js/base.js"></script>
</head>

<body>
<div class="wrapper">
 <!--Header-->
<%template src="_header.html"%>
<!--/Header-->
<div id="page_modules">

<div class="boxwrap" style=" width:978px;" >
<div class="left_con_m">
        <div class="tile_left_m">
   <div class="tile_zh">JuiceUp 欢迎您！</div>
          <div class="tile_en"><em class="black">MY</em><em class="darkGreen">JUICEUP</em></div>         
        </div>
        
      </div>
      <div  style=" padding-top:100px;">
  <div class="left180">
   <!--Sidebar-->
   <%template src="_ucenter_nav.html"%>
    <!--/Sidebar-->
  </div>
  
  <div class="right757">
    <h1 class="main_tit">
      <span><a href="<%linkurl("usercenter","index")%>">管理首页</a></span>
      我的订单
      <strong>Order</strong>
    </h1>
    
    <div class="order_box">
    <link href="<%templateskin%>/css/from/from.css" rel="stylesheet" type="text/css"
/>
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.core.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.theme.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.datepicker.css">
 <script src="<%templateskin%>/js/jquery.ui.core.js" type="text/javascript"></script>
                 <script src="<%templateskin%>/js/jquery.ui.datepicker.js"></script>
<script src="<%templateskin%>/js/jquery.ui.datepicker-zh-TW.js"></script>
<script type="text/javascript" src="<%templateskin%>/js/layout.js"></script>
<script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog_1"></script>
<script type="text/javascript" src="<%templateskin%>/js/base.js"></script>
<link rel="stylesheet" href="{config.webpath}css/validate.css" />
	<script type="text/javascript" src="{config.webpath}scripts/jquery/jquery.form.min.js"></script>
    <script type="text/javascript" src="{config.webpath}scripts/jquery/Validform_v5.3.2_min.js"></script>
      <!--订单状态.开始-->
      
    <div class="order_warp">
                   

                    <div class="orderNum">
                      
                      <span class="tile">
                        订单号：
                      </span>
                      {model.order_no}
                    </div>
                        <form name="order_form" id="order_form" url="{config.webpath}tools/submit_ajax.ashx?action=updateorder_save">
                    <div class="orderInfoWarp">
  <input id="goodsid" type="hidden" name="goodsid" value="{model.id}" />
                     <%set string addcount=""%>
                     <%set int addfive=0 %>
                   <%set int modelt__loop__id=0;%>
              <%csharp%> bool typebool=model.mobile=="1";<%/csharp%>
                 <%set DataTable category_list1=get_article_list("goods", 0, 10, "category_id!=44 and category_id!=45", "id desc")%>
                   <%foreach(ihongma.Model.order_goods modelt in model.order_goods)%>
 <%csharp%>modelt__loop__id++; int dates=0; if(modelt.deliverytime<DateTime.Now.AddDays(2)||modelt.goods_type==2){
 string classstr="has";
 if(modelt.deliverytime<DateTime.Now.AddDays(2))
 {
 classstr="hap";
 }
 <%/csharp%>

                     <div class="orderInfo {classstr}" id="Div1">
                            <span class="num">
                              {modelt__loop__id}.
                            </span>
                            <ul>
                           
                             <%if(!typebool)%>
                              <li>
                                <span class="tile">
                                  所选计划：
                                </span>
                                <span >
                                <select name="type{modelt.id}"    disabled="disabled" class="tetselect">
                                <%loop cdr1 category_list1%>
                                    <option value="{cdr1[id]}" <%if({modelt.goods_id}.ToString()=={cdr1[id]})%>
                                          selected="selected"
                                          <%/if%>>
                                 {cdr1[title]} <%if(model.post_code!="1")%>
                                     
                                          ×{model.post_code}人／份
                                       
                                        <%/if%>
                                    </option>
                                   <%/loop%>
                                </select>
                                </span>
                              </li>
                               <%else%>
                             
                               <li>     <span class="tile">订购类别：</span>
<span>{modelt.goods_title} <input id="Hidden2" name="type{modelt.id}" type="hidden" value="{modelt.id}" /></span></li>
<li> </li><li>

                  <span class="tile" >数量：</span>
                  <input type="text" value="{modelt.quantity}"    disabled="disabled" id="number" class="tetinput_small" />
                  <span class="tet">单位：张</span>
                </li>
                                <%/if%>
                              <li>
                                <span class="tile">
                                  送达日期：
                                </span>
     <input class="tetinput el"   name="date{modelt.id}" disabled="disabled" type="text" value="<%datetostr({modelt.deliverytime},yyyy-MM-dd)%>"
                                />
                              </li>
                              <li <%if(typebool)%>style="display:none;"<%/if%>>
                                <span class="tile"> 
                                  送达时间：
                                </span>
                                <span class="rule-single-select">
                                <select class="tetselect" disabled="disabled" name="time{modelt.id}" >
                                  <option  value="1" <%if({modelt.field1}.ToString()=="1")%>selected="selected"<%/if%>>
                                   2:00pm-6:00pm
                                  </option>
                                  <option value="2" <%if({modelt.field1}.ToString()=="2")%>selected="selected"<%/if%>>
                                      6:00pm-10:00pm
                                  </option>
                                </select></span>
                              </li>
                              <%if(IsUserLogin())%>
                                <li>
                                  <span class="tile">
                                    配送信息：
                                  </span>
                                  <span class="rule-single-select">
                                  <select class="tetselect" disabled="disabled" name="address{modelt.id}" class="rule-single-select" onchange="test(this)">
                                    <%set DataTable list1=get_user_address(userModel.id)%>
                                      <%loop item list1%>
                                    
                                        <option value="{item[id]}" <%if({item[status]}=={modelt.address_id}.ToString())%>
                                          selected="selected"
                                          <%/if%>
                                            >{item[address]}--{item[mobile]}--<%if({item[field1]}=="50")%> <%csharp%>addfive++;<%/csharp%>五环外<%else%>五环内<%/if%>
                                        </option>
                                        
                                        <%/loop%>
                                        <option value="0">添加新地址</option>
                                  </select></span>
                                </li>
                                <%/if%>
                            </ul>
                          </div>
                          <%else%>
                          <div class="orderInfo" id="Div2">
                            <span class="num">
                              <%csharp%>addcount=addcount+modelt.id.ToString()+",";<%/csharp%>
                              {modelt__loop__id}.
                            </span>
                            <ul>
                              <%if(!typebool)%>
                              <li>
                                <span class="tile">
                                  所选计划：
                                </span>
                                <span >
                                <select name="type{modelt.id}"   class="tetselect selecttest">
                                <%loop cdr1 category_list1%>
                                    <option value="{cdr1[id]}" <%if({modelt.goods_id}.ToString()=={cdr1[id]})%>
                                          selected="selected"
                                          <%/if%>>
                                 {cdr1[title]}<%if(model.post_code!="1")%>
                                     
                                          ×{model.post_code}人／份
                                       
                                        <%/if%>
                                    </option>
                                   <%/loop%>
                                </select>
                                </span>
                              </li>
                              <%else %>
                                    <li>     <span class="tile">订购类别：</span>
<span>{modelt.goods_title} <input id="Hidden1" name="type{modelt.id}" type="hidden" value="{modelt.id}" /></span></li>
<li> </li><li>

                  <span class="tile" >数量：</span>
                  <input type="text" value="{modelt.quantity}"    disabled="disabled" id="Text1" class="tetinput_small" />
                  <span class="tet">单位：张</span>
                </li>
                                <%/if%>
                              <li>
                                <span class="tile">
                                  送达日期：
                                </span>
                                  <%if(!typebool)%>
     <input class="tetinput  <%if(modelt__loop__id==1)%>el<%/if%> " id="date{modelt__loop__id}" style="<%if(modelt__loop__id>1)%>  background-image:url('');<%/if%>"   <%if(modelt__loop__id>1)%>  readonly="readonly"<%/if%>    name="date{modelt.id}"  type="text" value="<%datetostr({modelt.deliverytime},yyyy-MM-dd)%>"
                                />
                                  <%else %>
                                   <input class="tetinput el"       name="date{modelt.id}"  type="text" value="<%datetostr({modelt.deliverytime},yyyy-MM-dd)%>"
                                />
                                  <%/if%>
                              </li>
                              
                              <li <%if(typebool)%>style="display:none;"<%/if%>>
                                <span class="tile" >
                                  送达时间：
                                </span>
                                <span class="rule-single-select">
                                <select class="tetselect" name="time{modelt.id}" >
                                  <option  value="1" <%if({modelt.field1}=="1")%>selected="selected"<%/if%>>
                                     2:00pm-6:00pm
                                  </option>
                                  <option value="2" <%if({modelt.field1}=="2")%>selected="selected"<%/if%>>
                                     6:00pm-10:00pm
                                  </option>
                                </select></span>
                              </li>
                              <%if(IsUserLogin())%>
                                <li>
                                  <span class="tile">
                                    配送地址：
                                  </span>
                                  <span class="rule-single-select">
                                  <select class="tetselect"  name="address{modelt.id}" class="rule-single-select" onchange="test(this)">
                                    <%set DataTable list1=get_user_address(userModel.id)%>
                                      <%loop item list1%>
                                    
                                        <option value="{item[id]}" <%if({item[id]}=={modelt.address_id}.ToString())%>
                                          selected="selected"
                                          <%/if%>
                                            >{item[address]}--{item[mobile]}--<%if({item[field1]}=="50")%> <%csharp%>addfive++;<%/csharp%>五环外<%else%>五环内<%/if%>
                                        </option>
                                        
                                        <%/loop%>
                                        <option value="0">添加新地址</option>
                                  </select></span>
                                </li>
                                <%/if%>
                            </ul>
                          </div>
                          <%/if%>
                          <%/foreach%>
                       
                            <input id="addfive" name="addfive" value="<%=addcount%>" type="hidden" />
                    </div>
                    <div class="btn_next" >
                         <input id="btnSubmit" name="btnSubmit" type="submit" value="确认提交" class="btn btn-success marL10" />
                      <!--<a href="javascript:void(0);">
                        确认支付
                      </a>-->
                    </div>
                    </form>
                  </div>
  </div>
</div>
</div>
<div class="clear"></div>
<script>
Date.prototype.Format = function (fmt) { //author: meizz 
		        var o = {
		            "M+": this.getMonth() + 1, //月份 
		            "d+": this.getDate(), //日 
		            "h+": this.getHours(), //小时 
		            "m+": this.getMinutes(), //分 
		            "s+": this.getSeconds(), //秒 
		            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		            "S": this.getMilliseconds() //毫秒 
		        };
		        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
		        for (var k in o)
		            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
		        return fmt;
		    }
 var dateall=[];
function dateadd(date,i)
{
for(var j=0; j<i;j++) {
    dateall.push(new  Date(date.setDate(date.getDate() + 1)));
}
}
function tests(datep,type,i) {
    if(dateall.length==0)
    {
    var setdate = new Date();
    setdate.setFullYear(2014, 3, 6);

    dateadd(setdate, 2+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 3, 28);
    }else
    {
     setdate.setFullYear(2014, 3, 30);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 4, 11);
    }else
    {
     setdate.setFullYear(2014, 4, 12);
    }
    dateadd(setdate, 2+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 4, 29);
    }else
    {
    setdate.setFullYear(2014, 4, 31);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 8, 4);
    }else
    {
      setdate.setFullYear(2014, 8, 6);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 8, 29);
    }else
    {
    setdate.setFullYear(2014, 9, 1);
    }
    dateadd(setdate, 7+i);
   }
    for (var i=0; i<dateall.length; i++)
    {
        if (new Date(dateall[i]).Format("yyyy-MM-dd") == datep.Format("yyyy-MM-dd")) {
            return true;
        }
       
       // alert(new Date(dateall[i]).Format("yyyy-MM-dd"));

    }
    return false;
}
function selectedDate(date, type, i) {



    var d = date.getDay();
    var ret=[true,'hasCourse'];
    if (tests(date, type, i)) {
      return [false, 'noCourse'];
    }
    
if (date.Format("yyyy-MM-dd") =='2014-05-04') {
           return  [true,'hasCourse'];
        }
    if (type == 3) {
        if (d == 0 || d == 6||d == 4 || d == 5) {
          return [false, 'noCourse'];

        }
    }
    else {
        if (d == 0 || d == 6) {
           return [false, 'noCourse'];

        }
        
    }

    return ret;
}       

    $(function () {
        $(".selecttest").change(function () {
            var data = $(this).find("option:selected");
            $(".selecttest").val(data.val());
           
            $('.selecttest').find("option[value='"+data.val()+"']").attr("selected",true);
            // $(".select-tit").find("span").text(data.text());
            // $(this).siblings().removeClass("selected");
              //  $(this).addClass("selected"); //添加选中样式
               //titObj.find("span").text($(this).text()); //赋值选中值
            });
     if($("#addfive").val()=="")
     {
     $("#btnSubmit").hide();
     }
                      //表单提交
          AjaxInitForm('order_form', 'btnSubmit', 1);
                      //表单提交
         
                        var myDate = new Date();
                        myDate.setDate(myDate.getDate() + 2);
                     

                            $(".el").datepicker({ "minDate": myDate,
                                showOtherMonths: true,
                                selectOtherMonths: true,
                                beforeShowDay: function (date) {
	               
	                    return selectedDate(date, {modelt__loop__id}, 0);
	              

	            },
								onSelect: function (selectedDate) {
									if({modelt__loop__id}==3)
									{
									if($(this).attr("id")=="date1")
									{
										var newdate=new Date(selectedDate);
										 newdate.setDate(newdate.getDate() + 1);
										 $("#date2").val(newdate.Format("yyyy-MM-dd"));
										  newdate.setDate(newdate.getDate() + 1);
										 $("#date3").val(newdate.Format("yyyy-MM-dd"));
									}
									}
	             //   alert($(this).attr("id"));
	            }
                            });
                           
                    });
                    function user_address_add()
                    {
                    var dialog = $.dialog({
                   title:"请添加收货地址",
                   content: "url:<%linkurl("accept")%>",
                   min: false,
                   max: false,
                    lock: true,
                  close:function(){ location.reload(true);}
                  
                  });
                    }
                    
                    function test(obj)
                    {
                    if($(obj).val()=="0")
                    {
                     user_address_add();
                    }
                    }
                   //发送AJAX请求
    function sendAjaxUrl(winObj, postData, sendUrl) {
        $.ajax({
            type: "post",
            url: sendUrl,
            data: postData,
            dataType: "json",
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.dialog.alert('尝试发送失败，错误信息：' + errorThrown, function () { }, winObj);
            },
            success: function (data, textStatus) {
                if (data.status == 1) {
                    winObj.close();
                    $.dialog.tips(data.msg, 2, '32X32/succ.png', function () { location.reload(); }); //刷新页面
                } else {
                    $.dialog.alert('错误提示：' + data.msg, function () { }, winObj);
                }
            }
        });
    }
          
                    
	</script>

</div>

<div class="clear"></div>
</div>
<!--Footer-->
<%template src="_footer.html"%>
<!--/Footer-->

